package com.ruijiang.service.VmService.Impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.ruijiang.dto.page.PageNameDto;
import com.ruijiang.entity.VmType;
import com.ruijiang.mapper.VmServiceMapper.VmTypeMapper;
import com.ruijiang.result.PageResult;
import com.ruijiang.service.VmService.VmTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class VmTypeServiceImpl extends ServiceImpl<VmTypeMapper,VmType> implements VmTypeService {

    @Autowired
    private VmTypeMapper vmTypeMapper;

    /**
     * 获取售货机类型
     * @param typeId
     * @return
     */
    @Override
    public VmType getByTypeId(Integer typeId) {

        return vmTypeMapper.getByTypeId(typeId);

    }

    /**
     * 分页查询机型
     * @param dto
     * @return
     */
    @Override
    public PageResult getPageList(PageNameDto dto) {
        PageHelper.startPage(dto.getPageIndex(),dto.getPageSize());
        Page page =(Page) vmTypeMapper.getPageList(dto);
        return PageResult.pageBuild(page);
    }
}
